<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        //1.对象解构的基本语法
        let person = {name:"xx",age:18};
        //let {name,age} = person;
        // console.log(age,name);
        //对象解构的语法  { key -> 必须等于属性名和顺序没有关系 [绝对] }

        //2.解构起别名
        // {key->属性名:别名 }
        //let {name:n,age:a} = person;

        //3.解构嵌套类型
        // let obj = {p:['hello',{y:'world'}]};
        // let {p:[hh,{y}]} = obj;

        // let obj1 =  {name:'二狗子',age:18,bgfs:["111",{bfname:'刘德华'}]};
        // let {name,age,bgfs:[f,{bfname}]} = obj1;

        //4. 剩余对象内容   ...最后
        let {a,...b1}  = {a:1,b:2,c:3,d:4};
        console.log(a,b1);

        

    </script>
</body>
</html>